<?php
namespace Admin\Controller;

/**
 * 新闻资讯管理
 * @author  liubo <liubo@ilongyuan.com.cn>
 */
class CrawleNewsOriginController extends BaseManageController {
    /**
    *控制操作的模型表
    */
    protected $modelName = 'CrawleNewsOrigin';

    /**
    *删除类型的设置 true|直接删除， false|设置数据状态
    */  
    protected $is_del   = false;

    /**
    *跳转的Url
    */
    // protected $jumpAct  = 'News/index';

    protected $sort = 'date desc, _id desc';
    protected $base = [];

    public function _before_index()
    {
        $args = [];
        if (I('game')){
            $args['game'] = $game = I('game', '', 'trim');
            $this->where['game'] = $game;
            $this->assign('game', $game);
        }
        $this->assign('args', http_build_query($args));
        $allGames = $this->model->distinct('game');
        $this->assign('allGames', $allGames);
    }

    public function ajaxGetNews($id)
    {
        $res =  $this->model->where(['_id' => new \MongoId($id)])->find();
        $this->success($res);
    }

}